/*
 *    This file is part of BlobDB.
 *
 *    BlobDB is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    BlobDB is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with BlobDB.  If not, see <http://www.gnu.org/licenses/>.
 *    
 *    Copyright(c) 2011 Michael Kankkonen
 *    http://www.vnetcon.org
 */


package org.vnetcon.blobdb.driver.jdbc;

import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.util.Map;
import java.util.Properties;

public class BlobDBConnection implements Connection {

	org.vnetcon.blobdb.database.Statement nativeStatement = null;
	
	public BlobDBConnection(org.vnetcon.blobdb.database.Statement nativeStatement){
		this.nativeStatement = nativeStatement;
	}
	
	@Override
	public boolean isWrapperFor(Class<?> iface) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public <T> T unwrap(Class<T> iface) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public void clearWarnings() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public void close() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public void commit() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public Array createArrayOf(String arg0, Object[] arg1) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public Blob createBlob() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public Clob createClob() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public NClob createNClob() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public SQLXML createSQLXML() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public Statement createStatement() throws SQLException {
		BlobDBStatement stmt = new BlobDBStatement(this.nativeStatement);
		return stmt;
	}

	@Override
	public Statement createStatement(int arg0, int arg1) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public Statement createStatement(int arg0, int arg1, int arg2)
			throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public Struct createStruct(String arg0, Object[] arg1) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public boolean getAutoCommit() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public String getCatalog() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public Properties getClientInfo() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public String getClientInfo(String arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public int getHoldability() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public DatabaseMetaData getMetaData() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public int getTransactionIsolation() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public Map<String, Class<?>> getTypeMap() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public SQLWarning getWarnings() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public boolean isClosed() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public boolean isReadOnly() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public boolean isValid(int arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public String nativeSQL(String arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public CallableStatement prepareCall(String arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public CallableStatement prepareCall(String arg0, int arg1, int arg2)
			throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public CallableStatement prepareCall(String arg0, int arg1, int arg2,
			int arg3) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	/**
	 * Note!!! Here the bSQL statements question marks must have one empty space before
	 * and after the question mark. E.g. SELECT LANME FROM TEST.USER WHERE AGE = ? ;
	 * Wrong: SELECT LNAME FROM TEST.USER WHERE AGE=?;
	 */
	@Override
	public PreparedStatement prepareStatement(String bSQL) throws SQLException {
		BlobDBPreparedStatement stmt = new BlobDBPreparedStatement(this.nativeStatement, bSQL);
		return stmt;
	}

	@Override
	public PreparedStatement prepareStatement(String arg0, int arg1)
			throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public PreparedStatement prepareStatement(String arg0, int[] arg1)
			throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public PreparedStatement prepareStatement(String arg0, String[] arg1)
			throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public PreparedStatement prepareStatement(String arg0, int arg1, int arg2)
			throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public PreparedStatement prepareStatement(String arg0, int arg1, int arg2,
			int arg3) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public void releaseSavepoint(Savepoint arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public void rollback() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public void rollback(Savepoint arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public void setAutoCommit(boolean arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public void setCatalog(String arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public void setClientInfo(Properties arg0) throws SQLClientInfoException {
		throw new SQLClientInfoException(null);
	}

	@Override
	public void setClientInfo(String arg0, String arg1)
			throws SQLClientInfoException {
		throw new SQLClientInfoException(null);
	}

	@Override
	public void setHoldability(int arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public void setReadOnly(boolean arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public Savepoint setSavepoint() throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public Savepoint setSavepoint(String arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public void setTransactionIsolation(int arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

	@Override
	public void setTypeMap(Map<String, Class<?>> arg0) throws SQLException {
		throw new SQLException("Not implemented.");
	}

}
